<template>
    <div>
        <el-row>
            <el-col :span="showFlow?19:24">
                <slot></slot>

            </el-col>
            <el-col :span="showFlow?5:0">
                <FlowRecord v-if="showFlow" :id="flowId"></FlowRecord>
            </el-col>

            <el-col :span="24">
                <div class="card-wrap flex justify-end card-padding footer-margin">
                    <el-button @click="cancel">{{'write'==state?'取消':'返回'}}</el-button>
                    <el-button type="primary" v-if="'write'==state && 'all'==btnType" plain @click="submitForm(0)">保存</el-button>
                    <el-button v-if="'write'==state" type="primary" @click="submitForm(1)">提交</el-button>
                </div>
            </el-col>
        </el-row>
    </div>
</template>

<script>


import {deptTreeSelect, listUser} from "@/api/system/user";
import {purchaseAdd, purchaseUpdate, purchaseDetail, queryParamList} from "@/api/purchaseManage/purchaseList";
import {supplierList} from "@/api/memberManage/vendorList";
import AddInfo from "@/views/purchaseManage/purchaseList/components/addInfo.vue";
import {v1 as uuid_v1} from 'uuid'

export default {
    components: {AddInfo},
    props: {
        state: {
            type: String,
            default: ''
        },
        flowId: {
            type: String,
            default: ''
        },
        btnType: {
            type: String,
            default: 'all'
        },

    },
    computed: {
        showFlow() {
            // return 'write' != this.state && this.flowId !== undefined && this.flowId !== null && this.flowId !== ''
            return this.flowId !== undefined && this.flowId !== null && this.flowId !== ''
        }
    },

    methods: {
        cancel() {
            this.$router.back()
        },
        async submitForm(type) {
            this.$emit('submitForm', type)
        },

    }
};
</script>


<style lang="scss" scoped>
::v-deep .el-form--label-top .el-form-item__label {
    padding: 0;
}

.el-form-item {
    margin-bottom: 15px;
    width: 70%;
}

.icon_add {
    margin-left: 10px;
    cursor: pointer;
}

</style>
